<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Activity extends Model
{
    protected $table = 'activity';
    
    protected $fillable = [
        'title',
        'type_id',
        'start_time',
        'end_time',
        'max_people',
        'points',
        'content',
        'status',
        'is_recommended',
        'is_online'
    ];

    protected $casts = [
        'start_time' => 'datetime',
        'end_time' => 'datetime',
        'create_time' => 'datetime',
        'update_time' => 'datetime',
        'is_recommended' => 'boolean',
        'is_online' => 'boolean'
    ];

    // 指定时间戳字段名
    const CREATED_AT = 'create_time';
    const UPDATED_AT = 'update_time';

    public function type()
    {
        return $this->belongsTo(ActivityType::class, 'type_id');
    }
} 